package ga;

import java.util.ArrayList;

public class WeightSet {
	//public double w1;
	//public double w2;
	//public double w3;
	//public double w4;
	
	public ArrayList<Double> w;
	
	public WeightSet(double w1, double w2, double w3, double w4) {
		w = new ArrayList<Double>();
		w.add(w1);
		w.add(w2);
		w.add(w3);
		w.add(w4);
	}
	
	public WeightSet(double w1, double w2, double w3, double w4, double w5, double w6) {
		this(w1,w2,w3,w4);
		w.add(w5);
		w.add(w6);
	}
	
	public WeightSet(double w1, double w2, double w3, double w4, double w5, double w6, double w7) {
		this(w1,w2,w3,w4,w5,w6);
		w.add(w7);
	}
	
	public double weightSum() {
		double sum = 0;
		for(Double d: w) {
			sum += d;
		}	
		return sum;
	}
	
	public boolean equals(Object o) {
		if (this.weightSum() == ((WeightSet)o).weightSum())
			return true;
		
		return false;
		
	}
	
	public String toString() {
		String rv = "";
		int i=1;
		for (Double d: w) {
			rv += "w"+i+"="+d+"\n";
			i++;
		}
		
		return rv;
	}
}
